#include <variant>
#include <string>
#include <iostream>
#include <any>
#include <map>

using namespace std;

class Json
{
public:
    enum class Type
    {
        json_null = 0,
        json_bool,
        json_int,
        json_double,
        json_string,
        json_array,
        json_object
    };

    Json(any value)
    {
        if(value.type() == typeid(bool)) {
            m_type = Type::json_bool;
            m_value = any_cast<bool>(value);
            cout << "any 转为 bool 类型:" << get<bool>(m_value);
        } else if (value.type() == typeid(string))
        {
            m_type = Type::json_string;
            m_value = any_cast<string>(value);
        }
        
    }

private:
    using json_null = std::monostate;
    using Value = std::variant<int, bool, double, std::string, std::vector<Json>, std::map<std::string, Json>>;

    Type m_type;
    Value m_value;
};

int main()
{
    Json j("hello");
}